<?php
/**
 * StactaticsModel
 * @author tuanna
 * @version 1.0
 */

class StactaticsModel
{   
    function getStactaticsInMonth($year, $month, $user_id = NULL){
    	Zend_Loader::loadClass("PaymentHistoryModel");
    	
    	$year_month = "$year-$month";
		
		$model = new PaymentHistoryModel();
    	$list = $model->getListRecord("", $year_month, $year_month, $user_id);
    	
    	$return = array(
    		'total_money' => 0,
    		'total_fee' => 0,
    		'order_count' => 0
    	);
    	
    	foreach ($list as $row){
    		$return['total_money'] = $return['total_money'] + $row['total_money'];
    		$return['total_fee'] = $return['total_fee'] + $row['total_fee'];
    		$return['order_count'] = $return['order_count'] + $row['order_count']; 
    	}
    	
    	return $return;
    }
}